package com.quanyan.orderpay.service.check.account;

import com.quanyan.orderpay.service.check.account.impl.AlipayMessageDecoder;
import com.quanyan.orderpay.service.check.account.impl.ChinaumsMessageDecoder;
import com.quanyan.orderpay.service.check.account.impl.WechatRefundMessageDecoder;
import com.quanyan.orderpay.service.check.account.impl.WechatSuccessMessageDecoder;

/**
 * Created by pp.zuo on 2017/3/30.
 */
public class WaterMessageDecoderFactory {
    public static WaterMessageDecoder getDecoderByType(DecoderType type) {
        WaterMessageDecoder result = null;

        switch (type) {
            case WECHAT_REFUND:
                result = new WechatRefundMessageDecoder();
                break;
            case WECHAT_SUCCESS:
                result = new WechatSuccessMessageDecoder();
                break;
            case ALIPAY_ALL:
                result = new AlipayMessageDecoder();
                break;
            case CHINA_UMS:
                result = new ChinaumsMessageDecoder();
                break;
            default:
                throw new IllegalArgumentException("流水解析类型错误");
        }

        return result;
    }


    public static enum DecoderType {
        WECHAT_SUCCESS,
        WECHAT_REFUND,
        ALIPAY_ALL,
        CHINA_UMS
    }
}
